package Entity;

import java.io.Serializable;

import Controllers.UsersManager;

@SuppressWarnings("serial")
public class User implements Serializable 
{
	protected String firstName;
	protected String lastName;
	protected String email;
	protected String phone;
	protected int userId;
	protected String username;
	protected boolean allReadyLoggedIn;
	/**
	 * this method return the answer for the question if the user is allready logged to the system
	 * @return
	 */
	public boolean isAllReadyLoggedIn() {
		return allReadyLoggedIn;
	}
	/**
	 * setter allready logged in
	 * @param allReadyLoggedIn
	 */
	public void setAllReadyLoggedIn(boolean allReadyLoggedIn) {
		this.allReadyLoggedIn = allReadyLoggedIn;
	}
	protected int type;  // 0 = Worker  1 = Student   2 = Lecture 
	protected String descriptionType;
	
	/**
	 * getter description type
	 * @return
	 */
	public String getDescriptionType() {
		return descriptionType;
	}
	/**
	 * setter description type
	 * @param descriptionType
	 */
	public void setDescriptionType(String descriptionType) {
		this.descriptionType = descriptionType;
	}
	/**
	 * getter username
	 * @return
	 */
	public String getUsername() {
		return username;
	}
	/**
	 * setter username
	 * @param username
	 */
	public void setUsername(String username) {
		this.username = username;
	}
	public User()
	{
		
	}
	/**
	 * full constructor
	 * @param userId
	 * @param firstName
	 * @param lastName
	 * @param email
	 * @param phone
	 * @param username
	 * @param descriptionType
	 */
	public User(int userId,String firstName, String lastName, String email, String phone,String username,String descriptionType) 
	{
		super();
		this.firstName = firstName;
		this.lastName = lastName;
		this.email = email;
		this.phone = phone;
		this.userId = userId;
		this.username = username;
		this.descriptionType =descriptionType;
	}
	/**
	 * constructor form user
	 * @param us
	 */
	public User(User us)
	{
		super();
		this.firstName = us.getFirstName();
		this.lastName = us.getLastName();
		this.email = us.getEmail();
		this.phone = us.getPhone();
		this.userId = us.getUserId();
		this.username = us.getUsername();
		this.descriptionType = us.getDescriptionType();
	}
	

	public Request askRequestDetails(int reqID) 
	{
		return null;
		
	}
	
	public boolean checkIDCorrectness(int reqID) 
	{
		return false;
		
	}
	
	@Override
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString()
	{
		if (this.getFirstName()!= null && this.getLastName()!=null)
		{
			return (this.getFirstName() + " " +this.getLastName());
		}
		else
		{
			return("No name is assigned");
		}
	}
	
	
	
	
	
	
	
	
	
	
	/**
	 * 
	 * @return
	 */
	public int getUserId() {
		return userId;
	}
	/**
	 * 
	 * @param userId
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}
	/**
	 * 
	 * @return
	 */
	public String getFirstName() {
		return firstName;
	}
	/**
	 * 
	 * @param firstName
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	/**
	 * 
	 * @return
	 */
	public String getLastName() {
		return lastName;
	}
	/**
	 * 
	 * @param lastName
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	/**
	 * 
	 * @return
	 */
	public String getEmail() {
		return email;
	}
	/**
	 * 
	 * @param email
	 */
	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 * 
	 * @return
	 */
	public String getPhone() {
		return phone;
	}
	/**
	 * 
	 * @param phone
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}
	/**
	 * loggs off the user
	 */
	public void logoff() {
		// TODO Auto-generated method stub
		UsersManager.getInstance().logoff(this.userId);
	}

	
}
